<template>
  <div>
    <div class="circle" :style="{ backgroundColor: colorValue }"></div>
    <div style="margin: 20px 0;">
        <button @click="changeLight">红绿灯</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      colorValue: "red", // 颜色值
    };
  },
  methods: {
    changeLight() {
      if (this.colorValue === "red") {
        this.colorValue = "green";
      } else {
        this.colorValue = "red";
      }
    }
  },
};
</script>

<style scoped>
.circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
}
</style>
